﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CodeCounsel.SharePoint.RibbonDesigner.Model;
using System.Collections.ObjectModel;

namespace CodeCounsel.SharePoint.RibbonDesigner.ViewModel
{
    public class GroupSectionViewModel
        : GroupSectionBaseViewModel
    {
        Section _section;
        public ObservableCollection<GroupRowViewModel> Rows { get; private set; }

        public GroupSectionViewModel(Group group, Section section, Func<string, IEnumerable<Control>> controlSelector)
        {
            _section = section;
            Rows = new ObservableCollection<GroupRowViewModel>();
            foreach (GroupRowViewModel rowViewModel in section.Rows.Select(
                row => new GroupRowViewModel(group, row, controlSelector)))
            {
                Rows.Add(rowViewModel);
            }
        }
    }
}
